﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GcmpModelInterface.h"
#include "IObject.h"

namespace gcmp
{
    struct DocumentLoadOptions;
    /// \brief 文档打开验证器
    class GCMP_MODEL_INTERFACE_EXPORT IDocumentOpenValidator : public IObject
    {
        DEFINE_CAST_DERIVED(gcmp::IDocumentOpenValidator, gcmp::IObject)
    public:
        /// \brief 析构函数
        virtual ~IDocumentOpenValidator() = 0;

        /// \brief 文档打开验证器
        ///
        /// 此方法由框架调用，用户可重写此方法验证文档打开是否成功
        /// \param customDataFolderPath 用户自定义数据文件夹
        /// \param docLoadOptions 用户文档加载选项，请见DocumentLoadOptions.h
        /// \return true：验证成功，false：验证失败
        virtual bool ValidateBoforeDocumentOpen(const std::wstring& customDataFolderPath, DocumentLoadOptions& docLoadOptions) = 0;

        /// \brief 取错误信息
        /// \return std::wstring& 错误信息
        virtual const std::wstring& GetErrorMessage() = 0;

        /// \brief 文档打开验证器
        ///
        /// 此方法由框架调用，用户可重写此方法验证文档打开是否成功
        /// \param customDataFolderPath 用户自定义数据文件夹
        /// \return true：验证成功，false：验证失败
        GCMP_OBSOLETE_API(2021/05/18, IDocumentOpenValidator::ValidateBoforeDocumentOpen(const std::wstring&,DocumentLoadOptions&)) virtual bool ValidateBoforeDocumentOpen(const std::wstring& customDataFolderPath) = 0;
    };
    inline IDocumentOpenValidator::~IDocumentOpenValidator(){}
}


